<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateStudentWorksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('student_works', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('users_id')->comment("用户id");
            $table->unsignedInteger('course_id')->comment("课程id");
            $table->unsignedInteger('course_section_id')->comment("课程章节id");
            $table->unsignedInteger('school_id')->comment("学校id");
            $table->unsignedInteger('class_grades_id')->comment("班级id");
            $table->string('work_name')->comment("作业名称")->nullable();
            $table->string('work_file')->comment("作业文件")->nullable();
            $table->double('score', 8, 1)->comment("分数")->default(0)->nullable();
            $table->unsignedInteger('evaluate_users_id')->comment("评价教师id")->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('student_works');
    }
}
